CM_Locate_DevNodeA (setupapi)
Last changed: anonymous

.
Summary
The CM_Locate_DevNode function obtains a device instance handle to the device node that is associated with a specified device instance identifier, on the local machine.

C# Signatures:

[DllImport("setupapi.dll", SetLastError=true)]
static extern int CM_Locate_DevNodeA(ref int pdnDevInst, string pDeviceID, int ulFlags);

or

[DllImport("setupapi.dll", SetLastError=true)]
static extern int CM_Locate_DevNodeA(out IntPtr pdnDevInst, string pDeviceID, int ulFlags);

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

    public const int CM_LOCATE_DEVNODE_NORMAL = 0x00000000;
    public const int CR_SUCCESS = 0x00000000;

    string deviceId = "USB/V0001/P0001/&6&12&3";
    IntPtr pdnDevInst;
    int apiResult = CM_Locate_DevNodeA(out pdnDevInst, deviceId, CM_LOCATE_DEVNODE_NORMAL);
    if (apiResult != CR_SUCCESS)
    {
    // Handle error
    }

Documentation